module.exports = function ($resource, $state, $http, $q, $modal, dlq, $timeout) {
	return {
		restrict: 'AE',
		template: require('../views/p_order.html'),
		replace: true,
		scope: {
			'p' : '=',
			'close': '=',
			//'state' : '=',
			//'vm' : '=',
		},
		link: function (scope, elements, attrs) {

			console.log('order');

scope.gogo = function(){

	var para = {
		'id' : scope.p.id,
		'sale_code' : scope.p.sale_code,
		'cardno_state' : scope.p.cardno_state,
		'order_num_state' : scope.p.order_num_state,
		'order_limit_num' : scope.p.order_limit_num,
		'order_limit_type' : scope.p.order_limit_type,
	};

	$resource('/api/ac/wc/newProductService/createProduct', {}, {}).save(para, function(res){
		console.log(res);
		if (res.errcode !== 0) {
			alert(res.errmsg);
			return;
		}
		
		alert('操作成功');

	});

};			
		

		}
	};
};

